Skip to content

FEAT Consolidating scenario techniques#1785

Merged
rlundeen2 merged 12 commits into
microsoft:mainfrom
rlundeen2:users/rlundeen2/2026_05_22_scenario_technique_consolidation
May 29, 2026
Merged

FEAT Consolidating scenario techniques#1785
rlundeen2 merged 12 commits into
microsoft:mainfrom
rlundeen2:users/rlundeen2/2026_05_22_scenario_technique_consolidation

Conversation

@rlundeen2
Copy link
Copy Markdown
Contributor

@rlundeen2 rlundeen2 commented May 23, 2026

Replaces the separate AttackTechniqueSpec dataclass and scenario_techniques.py registration shim with a single self-describing AttackTechniqueFactory that owns both the technique configuration and the deferred attack construction. The only reason AttackTechniqueSpec existed was for how the CLI worked pre-REST api.

Now we can also move scenario registration centrally to initializers, which this PR also does.

@rlundeen2 rlundeen2 force-pushed the users/rlundeen2/2026_05_22_scenario_technique_consolidation branch from 275586f to c029636 Compare May 23, 2026 01:44
@romanlutz romanlutz changed the title FEAT Consolodating scenario techniques FEAT Consolidating scenario techniques May 23, 2026
rlundeen2 and others added 4 commits May 27, 2026 13:55
…05_22_scenario_technique_consolidation

# Conflicts:
#	pyrit/registry/object_registries/attack_technique_registry.py
Callers now pass adversarial_config directly (wrapping a bare PromptTarget
in AttackAdversarialConfig as needed). No registration site was using the
convenience kwarg, so removing it simplifies the factory API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace terse 'Forwarded to __init__' arg docs with descriptions matching
the __init__ prose. Hoist PromptSendingAttack, AttackAdversarialConfig,
AttackScoringConfig, and get_default_adversarial_target to module-level
imports — pyrit.executor does not import from pyrit.scenario, so there
is no circular-import risk.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rlundeen2 rlundeen2 marked this pull request as ready for review May 27, 2026 21:15
rlundeen2 and others added 2 commits May 27, 2026 16:43
…ending

PromptSendingAttack is intentionally not registered as a scenario
technique factory; BaselineAttackPolicy.Enabled prepends it as an
atomic attack instead. Update stale test expectations and drop the
empty single_turn aggregate from CyberStrategy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread pyrit/scenario/core/attack_technique_factory.py Outdated
Comment thread pyrit/scenario/core/attack_technique_factory.py Outdated
Comment thread pyrit/scenario/core/attack_technique_factory.py Outdated
Comment thread pyrit/scenario/scenarios/airt/cyber.py
rlundeen2 and others added 5 commits May 28, 2026 18:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop _adversarial_config_was_explicit flag; use a local variable in
create() for the lazily resolved default. Factory stays stateless
across create() calls and the explicit/lazy distinction is now expressible
via self._adversarial_config alone.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds AttackTechniqueRegistry.get_factories_or_raise() so scenario strategy builders and Scenario.initialize_async share one descriptive error when the registry hasn't been populated, instead of silently producing empty strategy enums or empty attack lists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…05_22_scenario_technique_consolidation

Resolves conflict in deleted pyrit/scenario/core/scenario_techniques.py by keeping the deletion (this PR's purpose) and porting main's new PAIRAttack technique into the consolidated pyrit/setup/initializers/components/scenario_techniques.py. Updated the merged-in test to use the new build_scenario_technique_factories() API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@hannahwestra25 hannahwestra25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! i like the simplification !

@rlundeen2 rlundeen2 added this pull request to the merge queue May 29, 2026
Merged via the queue into microsoft:main with commit dada588 May 29, 2026
48 checks passed
@rlundeen2 rlundeen2 deleted the users/rlundeen2/2026_05_22_scenario_technique_consolidation branch May 29, 2026 19:25
ValbuenaVC pushed a commit to ValbuenaVC/PyRIT that referenced this pull request May 29, 2026
…pt factory registry API

- Replace SCENARIO_TECHNIQUES/AttackTechniqueSpec with AttackTechniqueFactory registry
- Add @cache to _build_benchmark_strategy; drop deleted classmethods
- Adopt default_strategy=/default_dataset_config= in super().__init__ (microsoft#1784 contract)
- Loop: factory.create(attack_adversarial_config_override=AttackAdversarialConfig(target=...))
- Rename skip_cached -> use_cached throughout
- Test fixture: use build_scenario_technique_factories() + mock adversarial_chat
  target (matches PR microsoft#1785 pattern); module-level constants from production catalog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants